
.equ MEM_CTL_BASE,	0x48000000
.equ SDRAM_BASE,	0x30000000

.text
.global _start
_start:
	bl disable_WDT @bl指令会把返回地址保存在lr寄存器里面，所以汇编中返回是，直接mov pc,lr即可
	bl memsetup
	bl copy_steppingstone_to_sdram
	ldr pc,=on_sdram

on_sdram:
	ldr sp,=0x34000000 @sdram的起始地址为0x30000000,共64M,所以大小为0x34000000
	bl main
loop:
	b loop

disable_WDT:
	mov r1, #0x53000000
	mov r2, #0x0
	str r2, [r1]
	mov pc, lr @此处使用mov pc,lr 来返回程序

memsetup:
	@设置存储控制器以便使用SDRAM等外设
	mov r1, #MEM_CTL_BASE
	adrl r2,mem_cfg_val
	add r3,	r1,#52
1:
	ldr r4,[r2],#4
	str r4,[r1],#4
	cmp r1,r3
	bne 1b
	mov pc,lr

copy_steppingstone_to_sdram:
	mov r1,#0
	mov r2,#1024*4
	ldr r3,=SDRAM_BASE
2:
	ldr r4,[r1],#4
	str r4,[r3],#4
	cmp r2,r1
	bne 2b
	mov pc,lr


.align 4
mem_cfg_val:
	.long 0x22011110
	.long 0x00000700
	.long 0x00000700
	.long 0x00000700
	.long 0x00000700
	.long 0x00000700
	.long 0x00000700
	.long 0x00018005
	.long 0x00018005
	.long 0x008c07a3
	.long 0x000000b1
	.long 0x00000030
	.long 0x00000030


